import 'dart:convert';

import 'package:x3_base_core/x3_base_core.dart';

/// author：william on 2021/4/1 12:25
/// email：362661044@qq.com

class UserSelectModel extends BaseKeyValueModel {
  UserSelectModel({
    this.userId,
    this.userName,
    this.userImg,
  }) : super(key: userId, value: userName);

  factory UserSelectModel.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : UserSelectModel(
          userId: asT<String>(jsonRes['userId']),
          userName: asT<String>(jsonRes['userName']),
          userImg: asT<String>(jsonRes['userImg']),
        );

  String userId;
  String userName;
  String userImg;

  Map<String, dynamic> toJson() => <String, dynamic>{
        'userId': userId,
        'userName': userName,
        'userImg': userImg,
      };
  @override
  String toString() {
    return json.encode(this);
  }
}
